/**
 * @author 善良的YWJ
 * @Created by shanliangdeYWJ on 2022/02/13 04:04:10
 * @file schema.js
 * @description
 * ```
 * 所有 type ， reaolver 的导入整合导出
 * [参见](https://www.graphql-tools.com/docs/introduction)
 * ```
 * @link [Github](https://github.com/shanliangdeYWJ)
 */

const path = require('path')
const { mergeResolvers, mergeTypeDefs } = require('@graphql-tools/merge')
const { makeExecutableSchema } = require('@graphql-tools/schema')
const { loadFilesSync } = require('@graphql-tools/load-files')

const typeDefsArray = loadFilesSync(path.join(__dirname, './typeDefs'))
const tresolversArray = loadFilesSync(path.join(__dirname, './resolvers'))

const typeDefs = mergeTypeDefs(typeDefsArray)
const resolvers = mergeResolvers(tresolversArray)

module.exports = makeExecutableSchema({
  typeDefs,
  // resolver: (parent, args, context, info) => {}

  resolvers
})